//////////////////////////////////////////////////////////////////////////////
//																			//
//  Filename:    HillbilliesGuts.h											//
//  Developer:   Ben Wardlow												//
//  Create date: 3/01/2006													//
//																			//
//////////////////////////////////////////////////////////////////////////////
//																			//
//  Description: This is the class declaration for the slot gut of the		//
//               Australian Slot machine called Hillbillies.				//
//																			//
//////////////////////////////////////////////////////////////////////////////
//        Copyright (c) 2006 - Realtime Gaming.  All rights reserved.		//
//////////////////////////////////////////////////////////////////////////////
#ifndef __HILLBILLIES_GUTS_H__
#define __HILLBILLIES_GUTS_H__

#pragma once


#include "slotguts.h"
#include "getrand.h"

class HillbilliesGuts :
	public SlotGuts
{
        typedef SlotGuts super;
public:
	enum GutsRange
	{
		MIN = 1500,
		MAX = 1599
	};


private:

	#include "HillbilliesCommon.h"

	// Helpful lookup arrays.
	static SpinResult m_aLineWinSpinResults[][6];
	static SpinResult m_aScatterWinSpinResults[4];
	static SpinResult m_aFeatureWinSpinResults[4];
	static uint8 m_aHillbillyIcon[5];
	static uint8 m_aHillbillyMultiplier[5];
	static int8 m_aHillbillySubstitutionNote[5];
	static int8 m_aHillbillyBonusNote[5];
	static int32 m_aHillbillyScatterMask[5];

	// Inline functions that also do bounds checking to use with the arrays.
	static SpinResult lookupLineWinSpinResult( uint8 nIconType, uint8 nCount )
	{
		if ( nIconType < NUM_VALID_ICONS && nCount < 6 )
		{
			return m_aLineWinSpinResults[ nIconType ][ nCount ];
		}

		ASSERT( false );
		return EVT_INVALID;
	}

	static SpinResult lookupScatterWinSpinResult( uint8 nCount )
	{
		if ( nCount < 4 )
		{
			return m_aScatterWinSpinResults[ nCount ];
		}

		ASSERT( false );
		return EVT_INVALID;
	}

	static SpinResult lookupFeatureWinSpinResult( uint8 nCount )
	{
		if ( nCount < 4 )
		{
			return m_aFeatureWinSpinResults[ nCount ];
		}

		ASSERT( false );
		return EVT_INVALID;
	}

public:

	HillbilliesGuts(void);
	virtual ~HillbilliesGuts(void);

	virtual void classifyStops( SpinLine* spinLine, uint8* stops, uint8 bet, uint8 line,
		uint8& rtnResult, uint8& multiplier );

	virtual void classifyScatters( SlotSpin* spin );

	virtual bool8 isValidGuts();

	virtual void getGameModeMultiplierAndNoteId (uint8& nGameModeMultiplier, uint8& nNoteId );

protected:

	// Helper functions for classifyStops.
	SpinResult getLineWinResultWithPossibleSubstitution( uint8* stops, uint8 testIcon,
		bool& bSubstitution, uint8& multiplier ) const;

	bool8 isHillbillyIcon( uint8 testIcon ) const;

	// Helper functions for classifyScatters.
	void tryForJackpot( SlotSpin* spin );

	uint8 getNumHillbillyIcons( SlotSpin* spin, int32& scatterPositions ) const;

	void evaluateScatterWin( SlotSpin* spin, SpinResult srScatterResult, int32 scatterPositions );

	SpinResult getFeatureTriggerResult( SlotSpin* spin, int32& scatterPositions ) const;

	void evaluateFeatureTrigger( SlotSpin* spin, SpinResult srFeatureTriggerResult, int32 scatterPositions );

	void evaluateHillbillyBonusWin( SlotSpin* spin, SpinResult srHillbillyBonusResult, int32 scatterPositions );


	// Override of the framework function.
	virtual void preSpinClassifyResults( SlotSpin *spin );

};

#endif //__HILLBILLIES_GUTS_H__
